<template>
<div class="save-wrapper ui container" >
  <div class="ui very relaxed  grid">
    <div class="sixteen wide column">

      <form action="" class="ui form" @submit.prevent="submit_confirm">
        <div class="ui header">{{titleType}}商品类型</div>

        <div class="fluid field">
          <label for="">标题</label>
          <input type="text" v-model="vo.title" name="title" placeholder="请输入标题">
        </div>

        <div class="fluid field">
          <label for="">英文名</label>
          <input type="text" v-model="vo.name" name="name" placeholder="请输入英文名">
        </div>
        <div class="fluid field">
          <label for="">备注</label>
          <textarea  v-model="vo.desc" name="desc" placeholder="请输入备注"></textarea>
        </div>

        <p class="submitRow">
          <button type="submit" class="ui button">提 交</button>
        </p>
      </form>


    </div>
  </div>
</div>
</template>
<script type="text/ecmascript-6">
import tool from 'src/util/tool';
import util from '_util/index';
import logic from '_logic';

export default {
  data() {
    return {
      vo: null,
    }
  },
  watch: {
  },
  methods: {
    submit_confirm() {
      util.showConfirm(this, () => {
        this.onSubmit()
      },{content:'确认提交吗？'});
    },
    onSubmit() {
      let op = this.$store.state.global.op || 'insert';
      let url = tool.getApi(this,'Attr', op);

      util.http.SR(this, url, this.vo, '操作成功',()=>{
        let eventVue = util.store.get(this,'eventVue');
        eventVue.$emit('afterAdd')
      });

    }
  },
  computed: {
    titleType() {
      return logic.edit.get_titleType(this);
    },
    ctl() {
      return this.$route.query.ctl;
    },
  },
  components: {
  },
  mounted() {

  },
  props: [],
  created() {
    this.vo=util.store.get(this, 'editVo')

  }
}
</script>
<style rel="stylesheet/less" scoped lang="less">@import "../../common/style/mixin";
@dir: "edit/";
form {
    .submitBtn();
}
</style>
